/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Meas.impl;

import EA_Model.IEC61970.Core.impl.IdentifiedObjectImpl;

import EA_Model.IEC61970.Domain.AbsoluteDateTime;
import EA_Model.IEC61970.Domain.PerCent;

import EA_Model.IEC61970.Meas.MeasPackage;
import EA_Model.IEC61970.Meas.MeasurementValue;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Measurement Value</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.MeasurementValueImpl#getSensorAccuracy <em>Sensor Accuracy</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.MeasurementValueImpl#getTimeStamp <em>Time Stamp</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MeasurementValueImpl extends IdentifiedObjectImpl implements MeasurementValue {
	/**
	 * The cached value of the '{@link #getSensorAccuracy() <em>Sensor Accuracy</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSensorAccuracy()
	 * @generated
	 * @ordered
	 */
	protected PerCent sensorAccuracy;

	/**
	 * The cached value of the '{@link #getTimeStamp() <em>Time Stamp</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeStamp()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime timeStamp;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MeasurementValueImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MeasPackage.Literals.MEASUREMENT_VALUE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent getSensorAccuracy() {
		if (sensorAccuracy != null && sensorAccuracy.eIsProxy()) {
			InternalEObject oldSensorAccuracy = (InternalEObject)sensorAccuracy;
			sensorAccuracy = (PerCent)eResolveProxy(oldSensorAccuracy);
			if (sensorAccuracy != oldSensorAccuracy) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY, oldSensorAccuracy, sensorAccuracy));
			}
		}
		return sensorAccuracy;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent basicGetSensorAccuracy() {
		return sensorAccuracy;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSensorAccuracy(PerCent newSensorAccuracy) {
		PerCent oldSensorAccuracy = sensorAccuracy;
		sensorAccuracy = newSensorAccuracy;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY, oldSensorAccuracy, sensorAccuracy));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getTimeStamp() {
		if (timeStamp != null && timeStamp.eIsProxy()) {
			InternalEObject oldTimeStamp = (InternalEObject)timeStamp;
			timeStamp = (AbsoluteDateTime)eResolveProxy(oldTimeStamp);
			if (timeStamp != oldTimeStamp) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.MEASUREMENT_VALUE__TIME_STAMP, oldTimeStamp, timeStamp));
			}
		}
		return timeStamp;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetTimeStamp() {
		return timeStamp;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeStamp(AbsoluteDateTime newTimeStamp) {
		AbsoluteDateTime oldTimeStamp = timeStamp;
		timeStamp = newTimeStamp;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.MEASUREMENT_VALUE__TIME_STAMP, oldTimeStamp, timeStamp));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY:
				if (resolve) return getSensorAccuracy();
				return basicGetSensorAccuracy();
			case MeasPackage.MEASUREMENT_VALUE__TIME_STAMP:
				if (resolve) return getTimeStamp();
				return basicGetTimeStamp();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY:
				setSensorAccuracy((PerCent)newValue);
				return;
			case MeasPackage.MEASUREMENT_VALUE__TIME_STAMP:
				setTimeStamp((AbsoluteDateTime)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY:
				setSensorAccuracy((PerCent)null);
				return;
			case MeasPackage.MEASUREMENT_VALUE__TIME_STAMP:
				setTimeStamp((AbsoluteDateTime)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT_VALUE__SENSOR_ACCURACY:
				return sensorAccuracy != null;
			case MeasPackage.MEASUREMENT_VALUE__TIME_STAMP:
				return timeStamp != null;
		}
		return super.eIsSet(featureID);
	}

} //MeasurementValueImpl
